<script setup>
import { listUser } from '@/api/system/user.js'

const props = defineProps({
  multiple: {
    type: Boolean,
    default: false,
  },
})
const list = ref([])

const value = ref()
// 获取用户列表
const getList = async () => {
  try {
    const res = await listUser({
      pageNum: 1,
      pageSize: 999,
    })
    list.value = res.rows.map((item) => ({
      value: item.userId,
      label: item.nickName,
    }))
  } finally {
  }
}

getList()
</script>

<template>
  <p-select
    v-model="value"
    :option="list"
    :multiple="props.multiple"
    placeholder="请选择"
  />
</template>
